package com.lmf.service;

import com.lmf.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service(value = "userService2")
public class UserService2 {
    @Value(value = "刘明福")
    private String name;
    //添加注入属性注解
//    @Autowired  //根据类型进行注入
//    @Qualifier(value = "repository")  //根据名称进行注入
    @Resource(name = "repository")  //根据名称进行注入
    private UserDao userDao;

    public void show(){
        System.out.println("这是userService类 "+name);
        userDao.show();
    }


}
